One of the elements within a computer operating system is memory management. Memory management consists of hardware and software that controls the allocation and use of physical memory. The effect of memory management is exemplified in multiprogramming systems in which several processes reside in memory at the same time. Memory management typically includes a virtual memory system. The virtual memory system provides the CPU (central processing unit) with mapping information. The CPU generates virtual addresses when an image is executed. Before these virtual addresses can be used to access instructions and data, they must be translated into physical addresses. Memory management software maintains tables of mapping information (page tables) that keep track of where each page of virtual addresses is located in physical memory. The CPU uses this mapping information when it translates virtual addresses to physical addresses. The mapping of virtual addresses through page tables in a virtual memory system provides a large virtual address space, and allows programs to run on hardware with smaller physical memory configurations.
The range of virtual addresses is referred to as the virtual address space. The virtual address space is that set of virtual addresses accessible by the current process. A process is current when its process context is loaded into the CPU and the process is actively executing. Only one process may be current on a given CPU at a given time. In existing systems, the virtual address space is divided into a shared address space, sometimes referred to as the system address space, and a per-process address space. The per-process address space is referred to as process private space. The shared address space maps code and data shared by all processes, and that is available to any process that is current. The shared address space may for example contain operating system code and data used by all processes. The process private space maps code and data associated with and available to one specific process only when that specific process is current. When the process context is changed, a new process is made current, and the mapping of process private space is changed to map process private space to process private code and data of that process.
A page table is typically used to map the virtual address space to physical memory, in units of "pages". A page is a multibyte unit of memory having a predetermined size. The specific size of a page varies from system to system. A page table contains page table entries (PTEs), each one of which defines a relationship (referred to as a "mapping") between a single virtual page and a physical page of memory. The physical address of a physical page of memory is referred to as a page frame number (PFN). Thus a given virtual page of memory is "mapped" to a page of physical memory by a specific PTE, and similarly that physical page of memory is "mapped" to the virtual page by that specific PTE. The PTE in that case is referred to as "mapping" the virtual page and the physical page of memory.
In existing computer systems, page table entries within a page table may be located in either process private or shared space. Where page table entries mapping process private space for a given process are located within process private space, the contents of those page table entries can ordinarily only be accessed when that specific process is current. Thus for a process to access the process private page table entries of another process, a context switch is required. However context switching is expensive and efficient design requires that context switching be minimized.
The operating system must occasionally access the contents of a page table entry as a consequence of managing virtual and physical memory. For example, the operating system may need to access the page table entry mapping a page of virtual addresses to a specific given physical page of memory. This may occur as a result of completion of an asynchronous I/O request, in which a process issues the I/O request, and then relinquishes control of the CPU until the I/O request completes. At the completion of the I/O request, the operating system may need to access a number of PTEs indicated by the requesting process in the I/O request. However, when the I/O request completes, the original requesting process may not be current. Accordingly, the access must be performed independent of the process context in which the access was initiated. As a result, the operating system may need to access a page table entry mapping process private space of a requesting process that is not current. Changing process context whenever such a page table entry must be accessed would be prohibitively costly.
Generally, there are three categories of page table entries that must be accessed by the operating system:
(1) page table entries which map the process private space of a given process, and which are accessible through that process's process private space, where that process is current, PA1 (2) page table entries which map the process private space of a given process, and which are accessible through that process's process private space, where that process is not current, and PA1 (3) page table entries which map shared space, and which are accessible through shared space, and therefore accessible regardless of which process is current.
Therefore there is required a new system which permits access to page table entries by the operating system regardless of whether the page table entry to be accessed is mapped into shared space, the process private space of the current process, or the process private space of a process that is not current. The new system should provide access to page table entries with a minimum of context switching, regardless of which process is currently executing.